<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCategoryTaskPivotTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('category_task_pivot', function (Blueprint $table) {
            $table->unsignedInteger('category_id')->index()->comment('分类ID');
            $table->unsignedInteger('task_id')->index()->comment('任务ID');
            $table->primary(['category_id', 'task_id'])->comment('复合主键');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('category_task_pivot');
    }
}
